package sg.edu.nus.iss.vmcs.customer;

import java.awt.Dimension;
import java.awt.GridBagConstraints;
import java.awt.GridBagLayout;
import java.awt.Insets;
import java.awt.Panel;

import javax.swing.BorderFactory;
import javax.swing.JButton;
import javax.swing.JLabel;
import javax.swing.SwingConstants;

import sg.edu.nus.iss.vmcs.system.CoinInputListener;
import sg.edu.nus.iss.vmcs.system.DrinkSelectionButtonListener;
import sg.edu.nus.iss.vmcs.system.MainController;
import sg.edu.nus.iss.vmcs.util.WarningDisplay;


/**
* This code was edited or generated using CloudGarden's Jigloo
* SWT/Swing GUI Builder, which is free for non-commercial
* use. If Jigloo is being used commercially (ie, by a corporation,
* company or business for any purpose whatever) then you
* should purchase a license for each developer using Jigloo.
* Please visit www.cloudgarden.com for details.
* Use of Jigloo implies acceptance of these licensing terms.
* A COMMERCIAL LICENSE HAS NOT BEEN PURCHASED FOR
* THIS MACHINE, SO JIGLOO OR THIS CODE CANNOT BE USED
* LEGALLY FOR ANY CORPORATE OR COMMERCIAL PURPOSE.
*/
public class DrinksSelectionBox extends Panel {

	private JButton cocaCola1Btn;
	private JLabel jLabel2;
	private JLabel jLabel3;
	private WarningDisplay cocaCola1NISBtn;
	private JLabel jLabel1;
	private JLabel fantaLbl;
	private JLabel cocaCola1Lbl;
	private WarningDisplay cocaCola2NISBtn;
	private WarningDisplay soyaBEanNISBtn;
	private WarningDisplay sarsiNISBtn;
	private WarningDisplay fantaNISBtn;
	private JButton cocaCola2Btn;
	private JButton soyaBeanBtn;
	private JButton sarsiBtn;
	private JButton fantaBtn;
	private MainController mcntrl;
	private DrinkSelectionButtonListener drinkInputListener;

	public DrinksSelectionBox(MainController mcntrl) {
		super();
		this.mcntrl=mcntrl;
		drinkInputListener=new DrinkSelectionButtonListener(mcntrl);
		initGUI();
		// TODO Auto-generated constructor stub
	}

	private void initGUI() {
		try {
			{
				GridBagLayout thisLayout = new GridBagLayout();
				thisLayout.rowWeights = new double[] {0.1, 0.1, 0.1, 0.1, 0.1};
				thisLayout.rowHeights = new int[] {0, 0, 0, 0, 0};
				thisLayout.columnWeights = new double[] {0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1};
				thisLayout.columnWidths = new int[] {1, 1, 1, 1, 1, 1, 7};
				this.setLayout(thisLayout);
				//this.setSize(300, 600);
				this.setPreferredSize(new Dimension(650, 700));
				{
					cocaCola1Btn = new JButton();
					this.add(cocaCola1Btn, new GridBagConstraints(0, 0, 2, 1, 0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL, new Insets(10, 10, 10, 10), 0, 0));
					cocaCola1Btn.setText("Coca-Cola");
					cocaCola1Btn.setSize(70, 30);
					cocaCola1Btn.addActionListener(drinkInputListener);
				}
				{
					fantaBtn = new JButton();
					this.add(fantaBtn, new GridBagConstraints(0, 1, 2, 1, 0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL, new Insets(10, 10, 10, 10), 0, 0));
					fantaBtn.setText("Fanta");
					fantaBtn.addActionListener(drinkInputListener);
				}
				{
					sarsiBtn = new JButton();
					this.add(sarsiBtn, new GridBagConstraints(0, 2, 2, 1, 0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL, new Insets(10, 10, 10, 10), 0, 0));
					sarsiBtn.setText("Sarsi");
					sarsiBtn.addActionListener(drinkInputListener);
				}
				{
					soyaBeanBtn = new JButton();
					this.add(soyaBeanBtn, new GridBagConstraints(0, 3, 2, 1, 0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL, new Insets(10, 10, 10, 10), 0, 0));
					soyaBeanBtn.setText("Soya Bean");
					soyaBeanBtn.addActionListener(drinkInputListener);
				}
				{
					cocaCola2Btn = new JButton();
					this.add(cocaCola2Btn, new GridBagConstraints(0, 4, 2, 1, 0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL, new Insets(10, 10, 10, 10), 0, 0));
					cocaCola2Btn.setText("Coca-Cola");
					cocaCola2Btn.addActionListener(drinkInputListener);
				}
				{
					cocaCola1Lbl = new JLabel();
					this.add(cocaCola1Lbl, new GridBagConstraints(3, 0, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL, new Insets(10, 10, 10, 10), 0, 0));
					cocaCola1Lbl.setText("75 c");
					cocaCola1Lbl.setHorizontalAlignment(SwingConstants.CENTER);
					cocaCola1Lbl.setHorizontalTextPosition(SwingConstants.CENTER);
					cocaCola1Lbl.setBorder(BorderFactory.createTitledBorder(""));
				}
				{
					fantaLbl = new JLabel();
					this.add(fantaLbl, new GridBagConstraints(3, 1, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL, new Insets(10, 10, 10, 10), 0, 0));
					fantaLbl.setText("85 c");
					fantaLbl.setHorizontalAlignment(SwingConstants.CENTER);
					fantaLbl.setHorizontalTextPosition(SwingConstants.CENTER);
					fantaLbl.setBorder(BorderFactory.createTitledBorder(""));
				}
				{
					jLabel1 = new JLabel();
					this.add(jLabel1, new GridBagConstraints(3, 2, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL, new Insets(10, 10, 10, 10), 0, 0));
					jLabel1.setText("70 c");
					jLabel1.setBorder(BorderFactory.createTitledBorder(""));
					jLabel1.setHorizontalAlignment(SwingConstants.CENTER);
					jLabel1.setHorizontalTextPosition(SwingConstants.CENTER);
				}
				{
					jLabel2 = new JLabel();
					this.add(jLabel2, new GridBagConstraints(3, 3, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL, new Insets(10, 10, 10, 10), 0, 0));
					jLabel2.setText("60 c");
					jLabel2.setHorizontalAlignment(SwingConstants.CENTER);
					jLabel2.setHorizontalTextPosition(SwingConstants.CENTER);
					jLabel2.setBorder(BorderFactory.createTitledBorder(""));
				}
				{
					jLabel3 = new JLabel();
					this.add(jLabel3, new GridBagConstraints(3, 4, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL, new Insets(10, 10, 10, 10), 0, 0));
					jLabel3.setText("75 c");
					jLabel3.setBorder(BorderFactory.createTitledBorder(""));
					jLabel3.setHorizontalAlignment(SwingConstants.CENTER);
					jLabel3.setHorizontalTextPosition(SwingConstants.CENTER);
				}
				{
					cocaCola1NISBtn = new WarningDisplay("Not in Stock");
					this.add(cocaCola1NISBtn, new GridBagConstraints(5, 0, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL, new Insets(10, 10, 10, 10), 0, 0));
				}
				{
					fantaNISBtn = new WarningDisplay("Not in Stock");;
					this.add(fantaNISBtn, new GridBagConstraints(5, 1, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL, new Insets(10, 10, 10, 10), 0, 0));
				}
				{
					sarsiNISBtn = new WarningDisplay("Not in Stock");
					this.add(sarsiNISBtn, new GridBagConstraints(5, 2, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL, new Insets(10, 10, 10, 10), 0, 0));
				}
				{
					soyaBEanNISBtn = new WarningDisplay("Not in Stock");
					this.add(soyaBEanNISBtn, new GridBagConstraints(5, 3, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL, new Insets(10, 10, 10, 10), 0, 0));
				}
				{
					cocaCola2NISBtn = new WarningDisplay("Not in Stock");
					this.add(cocaCola2NISBtn, new GridBagConstraints(5, 4, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL, new Insets(10, 10, 10, 10), 0, 0));
				}
			}
		} catch(Exception e) {
			e.printStackTrace();
		}
	}
	
	public void display() {
		this.setVisible(true);
	}

	public void setDrinkSelectionBoxActive(boolean bool)
	{
		cocaCola2Btn.setEnabled(bool);
		soyaBeanBtn.setEnabled(bool);
		sarsiBtn.setEnabled(bool);
		fantaBtn.setEnabled(bool);
		cocaCola1Btn.setEnabled(bool);
		
	}
}
